package puyu.manage.service.utils.except;


import puyu.manage.service.utils.MessageUtils;

public class CustomException extends RuntimeException {
    private Integer code;
    private String message;

    public CustomException(String message) {
        this.message = MessageUtils.message(message, new Object[0]);
    }

    public CustomException(String message, Object... args) {
        this.message = MessageUtils.message(message, args);
    }

    public CustomException(String message, Integer code) {
        this.message = MessageUtils.message(message, new Object[]{code});
        this.code = code;
    }

    public CustomException(String message, Integer code, Object... args) {
        this.message = MessageUtils.message(message, new Object[]{code, args});
        this.code = code;
    }

    public CustomException(String message, Throwable e) {
        super(message, e);
        this.message = message;
    }

    public String getMessage() {
        return this.message;
    }

    public Integer getCode() {
        return this.code;
    }
}
